/*
    The NeonX Library

    Copyright (c) 2013 darkcat

    Code covered by the MIT License
*/

#pragma once

// nx...
#include "config/general.h"
// NX_ALLOC
#include "memory/memalloc.h"
// nx::deque
#include "container/deque.h"
// Special assign algorithm
#include "algorithm/assign.h"

// std::stack
#include <stack>

//////////////////////////////////////////////////////////////////////////
NX_BEG
//////////////////////////////////////////////////////////////////////////

template <typename Type_, typename Seq_ = nx::deque<Type_> >
class stack : public std::stack<Type_, Seq_>
{
public:
    typedef std::stack<Type_, Seq_> base_t;

public:
    explicit stack(const Seq_& s = Seq_())
        : base_t(s)
    {}
};

/*
    Special assign algorithm
*/

template <typename T_, typename S_>
struct Push<stack<T_, S_> >
{
    typedef stack<T_, S_> T;
    template <typename V>
    static void _(const V& val, typename TraitsContainer<T>::ite_t /*ite*/, T& set)
    { set.push(val); }
};

template <typename T_, typename S_>
struct Pop<stack<T_, S_> >
{
    typedef stack<T_, S_> T;
    static void _(typename TraitsContainer<T>::ite_t /*ite*/, T& set)
    { set.pop(); }
};

//////////////////////////////////////////////////////////////////////////
NX_END
//////////////////////////////////////////////////////////////////////////
